package edu.gdkm.dao;

import edu.gdkm.pojo.Department;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DepartmentDAO {
    @Select("select * from department where id = #{id}")
    Department findById(Integer id);
    @Select("select * from department where name = #{name}")
    Department findByName(String name);
    @Select("select * from department")
    List<Department> findAll();
    @Insert("insert into department(name, description, created_time) values(#{name}, #{description}, #{created_time})")
    boolean save(Department department);
    @Update("update department set name = #{name}, description = #{description}, created_time = #{created_time} where id = #{id}")
    boolean update(Department department);
    @Delete("delete from department where id = #{id}")
    boolean delete(Integer id);

}
